<!doctype html>
<html>
<head>
    <meta charset="utf-8"/>
    <title>有奖答题平台</title>
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"/>
    <link rel="stylesheet" href="/lib/mobile/css/common.css"/>
    <link rel="stylesheet" href="/lib/mobile/css/review.css"/>
    <link rel="stylesheet" href="/mobile/css/bui.css" />
</head>
<body style="background-color: #f1f2f4;">
<div class="main">
    <div class="main_title">
        <div class="title_left">本月</div>
        <div class="title_right"><span class="score">智慧币</span></div>
    </div>
        <ul class="bui-list review_list">
            <div id="ywclist" class="bui-scroll">
                <div class="bui-scroll-head"></div>
                <div class="bui-scroll-main">
                    <ul class="bui-list bui-list-thumbnail" id="ddlb">

                    </ul>
                </div>
                <div class="bui-scroll-foot"></div>
            </div>
        </ul>
    <div class="review_caption">展现近30天的中奖记录</div>
    <ul class="bottom_menu">
        <li  id="indexsy"><a href="javascript:void(0);">首页</a></li>
        <!--<li>|</li>-->
        <li  id="hdrule"><a href="javascript:void(0);">活动规则</a></li>
        <!--<li  id="point_rule"><a href="javascript:void(0);">积分规则</a></li>-->
        <!--<li>|</li>-->
        <!--<li id="prize_rule"><a href="javascript:void(0);">抽奖规则</a></li>-->
        <!--<li>|</li>-->
        <li id="center"><a href="javascript:void(0);">个人中心</a></li>
    </ul>
</div>
<!-- 依赖库 手机调试的js引用顺序如下 -->
<script src="/lib/mobile/js/zepto.js"></script>
<script src="/lib/mobile/js/plugins/fastclick.js"></script>
<script src="/lib/mobile/js/bui.js"></script>
<script src="/lib/mobile/js/common.js?11    "></script>
<script>
    bui.ready(function () {
        // 这里写业务及控件初始化
        var storage = bui.storage();
        bui.btn({id: ".bui-page", handle: ".bui-btn"}).load();
        var pageview = {};
        pageview.init = function () {
            // 验证码示例
            $("#rank_person").on("click", function (argument) {
                $("#rank_person").addClass("on");
                $("#rank_company").removeClass("on");
                bui.load({ url: BASE_URL+"mobile/rank_person"});
            });
            $("#rank_company").on("click", function (argument) {
                $("#rank_company").addClass("on");
                $("#rank_person").removeClass("on");
                bui.load({ url: BASE_URL+"mobile/rank_company"});
            });

            var uid=storage.get("uid");
            //我的积分
            getAwardList(uid[0]);
        }
        pageview.init();
    })

    function getAwardList(uid){
        bui.list({
            id: "#ywclist",
            url: BASE_URL+"mobile/getDayAwardList",
            pageSize: 10,
            data: {uid:uid},
            field: {
                page: "page",
                size: "pageSize",
                data: "data"
            },
            callback: function(e) {
                // e.target 为你当前点击的元素
                // e.currentTarget 为你当前点击的handle 整行
            },
            template: function(data) {
                var html = "";
                // console.log(data);
                data.forEach(function(el, index) {
                    console.log(el);
                    html += `<li>
                                <dl>
                                       <dt>
                                            <p class="title">中奖记录</p>
                                           <p class="other">${el.awardtime}</p>
                                       </dt>
                                         <dd><strong>+${el.award}</strong></dd>
                                  </dl>
                               </li>`;
                });
                return html;
            },
            onBeforeRefresh: function() {
                // console.log("brefore refresh")
            },
            onBeforeLoad: function() {
                // console.log("brefore load")
            },
            onRefresh: function() {
                // 刷新以后执行
                // console.log("refreshed")
            },
            onLoad: function() {
                // 刷新以后执行
                // console.log("loaded")
            }
        })
    }
</script>
</body>
</html>